import { requestClient } from '#/api/request';

/** 合伙人申请列表参数 */
export interface PartnershipListParams {
  username?: string;
  current_page: number;
}

/** 合伙人申请信息 */
export interface PartnershipInfo {
  id: number;
  username: string;
  phone: string;
  wechat: string;
  status: string;
  apply_time: string;
  comment: string;
  current_page: number;
  total_page: number;
}

/** 审批参数 */
export interface ApprovalParams {
  id: number;
  status: number;
  comment: string;
}

/** 提款申请列表参数 */
export interface WithdrawListParams {
  username?: string;
  status: number;
  current_page: number;
}

/** 提款申请信息 */
export interface WithdrawInfo {
  id: number;
  username: string;
  alipay_account: string;
  alipay_name: string;
  money: number;
  fee: number;
  received_money: number;
  apply_status: string;
  apply_time: string;
  deal_time: string;
  comment: string;
  detail: string;
}

/** 处理提款参数 */
export interface DealWithdrawParams {
  id: number;
  comment: string;
}

/**
 * 获取合伙人申请列表
 */
export async function getPartnershipListApi(params: PartnershipListParams) {
  return requestClient.post<PartnershipInfo[]>(
    '/v1/wyyl/get/all/apply/partnership',
    params,
  );
}

/**
 * 审批合伙人申请
 */
export async function approvePartnershipApi(params: ApprovalParams) {
  return requestClient.post('/v1/wyyl/deal/apply/partnership', params);
}

/**
 * 获取提款申请列表
 */
export async function getWithdrawListApi(params: WithdrawListParams) {
  return requestClient.post<WithdrawInfo[]>(
    '/v1/wyyl/withdraw/all/order/',
    params,
  );
}

/**
 * 处理提款申请
 */
export async function dealWithdrawApi(params: DealWithdrawParams) {
  return requestClient.post('/v1/wyyl/deal/withdraw/', params);
}
